﻿#region Copyright(c) 2006 ZO, All right reserved.
// -----------------------------------------------------------------------------
// Copyright(c) 2006 ZO, All right reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   1.  Redistribution of source code must retain the above copyright notice,
//       this list of conditions and the following disclaimer.
//   2.  Redistribution in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//   3.  The name of the author may not be used to endorse or promote products
//       derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
#endregion


#region Using directives



#endregion

namespace ZO.SmartCore.Protocols.XMPP.Protocol.Common
{
    /// <summary>
    /// An XML stanza is a discrete semantic unit of structured 
    /// information that is sent from one entity to another over an XML stream. 
    /// An XML stanza exists at the direct child level of the root "stream" element.
    /// </summary>
    public abstract class Stanza : Packet
    {

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="Stanza"/> class.
        /// </summary>
        /// <param name="name">Name of the element.</param>
        protected Stanza(string name) : base(name) { } // Stanza


        /// <summary>
        /// Initializes a new instance of the <see cref="Stanza"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// <param name="ns">The ns.</param>
        protected Stanza(string name, string value, string ns) : base(name, value, ns) { } // Stanza

        /// <summary>
        /// Initializes a new instance of the <see cref="Stanza"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// <param name="ns">The ns.</param>
        /// <param name="prefix">The prefix.</param>
        protected Stanza(string name, string value, string ns, string prefix) : base(name, value, ns, prefix) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="Stanza"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// <param name="ns">The ns.</param>
        /// <param name="prefix">The prefix.</param>
        /// <param name="ns2">The NS2.</param>
        protected Stanza(string name, string value, string ns, string prefix, string ns2) : base(name, value, ns, prefix, ns2) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="Stanza"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        protected Stanza(string name, string value)
            : base(name, value)
        {
        } // Stanza
        #endregion

        #region Destructor

        #endregion

        #region Fields

        #endregion

        #region Events

        #endregion

        #region Operators

        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets the error.
        /// </summary>
        /// <value>The error.</value>
        public StanzaError Error
        {
            get
            {
                return this.SelectSingleElement<StanzaError>();
            }
            set
            {
                if (this.HasChildElement<StanzaError>())
                {
                    this.RemoveChildElement<StanzaError>();
                }
                this.AddChildElement(value);
            }
        }
        #endregion

        #region Methods

        #endregion
    }
}
